package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.wx.search.vo.IndexVo;
import com.cskaoyan.service.wx.WxSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Name : WxSearchController.java
 * @Time : 2021/8/16 19:39
 * @Author : creamycandy
 * @Software : IntelliJ IDEA
 */

@RestController
@RequestMapping("wx/search")
public class WxSearchController {


    @Autowired
    WxSearchService wxSearchService;

    @RequestMapping("index")
    public BaseRespVo searchIndex(){
        IndexVo searchIndex = wxSearchService.getSearchIndex();
        return BaseRespVo.ok(searchIndex);
    }


    @RequestMapping("helper")
    public BaseRespVo searchHelper(String keyword){
        List<String> searchContent = wxSearchService.getSearchContent(keyword);
        return BaseRespVo.ok(searchContent);
    }


    @RequestMapping("clearhistory")
    public BaseRespVo clearHistory(){
        wxSearchService.clearHistory();
        return BaseRespVo.ok();
    }
}
